<!-- 主页-请购单-新增 -->
<!--<script src="js/proinfo/purchase/buyingApplyFor-add.js"></script>-->
<script src="js/CertusFileUpload.js"></script>
<section id="container">
    <!--main content start-->
    <section id="main-content">
        <section class="wrapper">
            <!--state overview end-->
            <div class="row">
                <div class="col-lg-12">
                    <div class="alert alert-block alert-warning fade in">
                        <button data-dismiss="alert" class="close close-sm" type="button">
                            <i class="icon-remove"></i>
                        </button>
                        <strong>注意事项：</strong><br />
                        1、只有立项通过的项目才可以挂靠费用和进行采购等；<br />
                        2、如果费用的发生为了某个线索阶段的项目，请选择该线索阶段项目归属的部门项目挂靠费用；<br/>
                        3、“归属分公司”的选择必须保证对应项目有本地成员（即有本地人事签约的成员）、销售项目的签约主体是选择的归属分公司，尤其是供内部使用的采购。否则要在满足上述条件的分公司提交。请提交人以及相应财务审批人员操作时候注意核实。
                    </div>
                    <section class="panel">
                        <header class="panel-heading">
                            基本信息
                        </header>
                        <div class="panel-body">
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">项目名称</label>
                                <div class="col-sm-10" >
                                    <input type="text" id="projNameId" proj-name-list="applyInfo.projId,applyInfo.projName"  certus-required
                                        class="form-control" placeholder="自动检索，查询结果较多时候，系统不显示，需要尽量多输入相关字段">

                                    <!--<datalist id="browsers22" ng-model="selected">-->
                                        <!--<option ng-repeat="x in userProjSelect2" value="{{x.projName}}">-->
                                    <!--</datalist>-->
                                </div>
                            </div>
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">申请用途</label>
                                <div class="col-sm-10">
                                    <select ng-model="applyInfo.applicationCode" certus-required class="form-control">
                                        <option ng-repeat="x in select.applyForSelect" value="{{x.code}}">
                                            {{x.name}}
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">归属分公司选择</label>
                                <div class="col-sm-10">
                                    <select ng-model="applyInfo.affiliationCode" certus-required class="form-control">
                                        <option ng-repeat="x in select.affiliationSelect" value="{{x.code}}">
                                            {{x.name}}
                                        </option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">文件上传</label>
                                <div class="col-sm-5">
                                    <a class="upload-icon" onclick="shuplod();">上传附件</a>
                                </div>
                                <div class="col-sm-5">
                                    <a class="upload-icon" onclick="listUploadFilePurchase();">查看已上传附件</a>
                                </div>
                            </div>
                        </div>
                    </section>


                    <section class="panel shuplod" style="display:none;">
                        <header class="panel-heading">
                            文件上传
                        </header>
                        <div class="panel-body">
                            <div ng-include="'templates/upload-file.html'"></div>
                            <p class="default-buttons">
                                <a href="javascript:void(0);" class="button-back btn btn-info" onclick="shuplod()">取消</a>
                                <a href="javascript:void(0);" class="button-next  btn btn-info toRegu" ng-click="addFileBuy()">提交</a>
                            </p>
                        </div>
                    </section>

                    <section class="panel shadbox" style="display:none;">
                        <header class="panel-heading">
                            请购信息
                        </header>
                        <div class="panel-body">
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">大类</label>
                                <div class="col-sm-10">
                                    <select class="form-control" certus_required_polyfill ng-model="applyItem.bigClassCode"
                                        ng-change="sbchanged(applyItem.bigClassCode)">
                                        <option ng-repeat="x in select.bigClassSelect" value="{{x.code}}">
                                            {{x.name}}
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group customerForm typesel-option" ng-show="sbshow">
                                <label class="col-sm-2 control-label">资产类目</label>
                                <div class="col-sm-10">
                                    <select class="form-control" certus_required_polyfill ng-model="applyItem.commodityCateCode"
                                        ng-change="cateChange(applyItem.commodityCateCode)">
                                        <option ng-repeat="x in select.cateCodeSelect" value="{{x.code}}">
                                            {{x.name}}
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group customerForm typesel-option" ng-show="sbshow">
                                <label class="col-sm-2 control-label">资产类别</label>
                                <div class="col-sm-10">
                                    <select class="form-control" certus_required_polyfill ng-model="applyItem.commodityClassCode">
                                        <option ng-repeat="x in select.classCodeSelect" value="{{x.code}}">{{x.name}}
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group customerForm" ng-show="sbbushow">
                                <label class="col-sm-2 control-label">类型说明</label>
                                <div class="col-sm-10">
                                    <input type="text" certus_required_polyfill class="form-control"
                                        certus_an_limit_length="50" ng-model="applyItem.typeMark">
                                </div>
                            </div>
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input type="text" certus_required_polyfill class="form-control" ng-model="applyItem.name">
                                </div>
                            </div>
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">品名及规格</label>
                                <div class="col-sm-10">
                                    <input type="text" certus_required_polyfill certus_an_limit_length="250" class="form-control"
                                        ng-model="applyItem.descAndSpec">
                                </div>
                            </div>
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">数量</label>
                                <div class="col-sm-10">
                                    <input type="text" certus_an_limit_length_num="50" certus_required_polyfill class="form-control"
                                        ng-model="applyItem.quantity">
                                </div>
                            </div>
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">单价</label>
                                <div class="col-sm-10">
                                    <input type="text" certus_an_limit_length_num="50" certus_required_polyfill class="form-control"
                                        ng-model="applyItem.singlePrice">
                                </div>
                            </div>
                            <div class="form-group customerForm" ng-if="applyItem.singlePrice && applyItem.quantity">
                                <label class="col-sm-2 control-label">总价</label>
                                <div class="col-sm-10">
                                    <input type="text" certus_an_limit_length_num="50" certus_required_polyfill class="form-control"
                                        ng-model="applyItem.estimatedAmount = applyItem.singlePrice*applyItem.quantity "
                                        value="{{applyItem.singlePrice*applyItem.quantity}}" disabled>
                                </div>
                            </div>
                            <div class="form-group customerForm">
                                <label class="col-sm-2 control-label">备注</label>
                                <div class="col-sm-10">
                                    <textarea class="form-control" certus_an_limit_length="200"
                                        certus_required_polyfill ng-model="applyItem.remark" placeholder="购买情况说明，例如：A产品无法购买时，可以购买B产品代替；或者A产品无法购买，B产品也不需要购买等……"></textarea>
                                </div>
                            </div>
                            <p class="default-buttons">
                                <a href="javascript:void(0);" class="button-back btn btn-info" onclick="shadbox();">取消</a>
                                <!--添加采购条目-->
                                <a href="javascript:void(0);" class="button-next  btn btn-info" ng-click="applyItemSubmit()">确认</a>
                            </p>
                        </div>
                    </section>

                    <section class="panel">
                        <header class="panel-heading">
                            请购列表<i class="add-icon icon-plus" onclick="shadbox();"> 新增</i>
                        </header>
                        <div class="panel-body">
                            <div id="purchaselogContainer" class="dlshouwen-grid-container"></div>
                            <div id="purchaselogToolBarContainer" class="dlshouwen-grid-toolbar-container"></div>
                        </div>
                    </section>
                    <section class="panel">
                        <header class="panel-heading">
                            <div class="pro-search">
                                资产库列表<i class="add-icon icon-plus" data-toggle="modal" href="#myModal"> 新增</i>
                            </div>
                        </header>
                        <div class="panel-body">
                            <div id="assetslogContainer" class="dlshouwen-grid-container"></div>
                            <div id="assetslogToolBarContainer" class="dlshouwen-grid-toolbar-container"></div>
                        </div>
                    </section>

                    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                        aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <section class="panel">
                                    <div class="panel-heading add-heading">
                                        资产库信息
                                        <i class="add-icon icon-remove" data-dismiss="modal" aria-hidden="true"></i>
                                    </div>
                                    <div class="panel-body">
                                        <div class="search-heading">
                                            <span>放置地:</span>
                                            <select class="form-control" ng-model="select.addr">
                                                <option ng-repeat="x in select.affiliationSelect" value="{{x.code}}">
                                                    {{x.name}}
                                                </option>
                                            </select>
                                            <span>资产类别:</span>
                                            <select class="form-control" ng-model="select.productType">
                                                <option ng-repeat="x in select.assetClassSelect" value="{{x.styleId}}">
                                                    {{x.assetStyle2}}
                                                </option>
                                            </select>
                                            <label class="label label-primary" ng-click="searchProduct()">搜索</label>
                                        </div>
                                        <div id="lidContainer" class="dlshouwen-grid-container"></div>
                                        <div id="lidToolBarContainer" class="dlshouwen-grid-toolbar-container"></div>
                                    </div>
                                    <div class="panel-bg"></div>
                                </section>
                            </div>
                            <!-- /.modal-content -->
                        </div>
                        <!-- /.modal-dialog -->
                    </div>

                    <section class="panel">
                        <header class="panel-heading">
                            申请说明
                        </header>
                        <div class="panel-body">
                            <div class="form-group customerForm">
                               
                                    <textarea class="form-control" ng-model="applyInfo.applyInstruction"></textarea>
                             
                            </div>

                        </div>
                    </section>


                    <!-- <section class="panel">
                        <div class="panel-heading">
                            审批记录
                        </div>
                        <div class="panel-body">
                            <ul class="tp-ulst">
                                <li>
                                    <span>人员姓名</span><span>修改时间</span><span>处理结果</span>
                                </li>
                                <li>
                                    <span>张三测试</span><span>2010-18-24 18:00</span><span>发起申请/同意/不同意/退回，内容：说明内容/审批意见</span>
                                </li>
                            </ul>
                        </div>
                    </section> -->

                    <section class="panel">
                        <div class="panel-body">
                            <p class="default-buttons">
                                <a href="javascript:void(0);" class="button-back btn btn-info" onclick="window.history.back()">返回</a>
                                <a href="javascript:void(0);" class="button-next  btn btn-success" ng-click="submmitPurchase()">确认提交</a>
                            </p>
                        </div>
                    </section>
                </div>
            </div>
        </section>
    </section>
    <!--main content end-->
</section>

<script type="text/javascript" src="js/purchase/purchase.js"></script>